<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

class Front extends CI_Controller {

    public function __construct() {
        parent::__construct();
        $this->load->helper('url');
        //$this->load->helper('file');
        $this->load->database();
        $this->load->helper('fuc');
        //$this->load->library('topclass');
    }

	/* ====淘宝iframe中的地址
		http://container.api.taobao.com/container?
		appkey=21104397
		&seller_nick=幻想de味道
		&envMode=edit
		&module_width=750
		&shop_id=34905576
		
		====回调后的地址
		http://100.iporpre.com/index.php/front?
		top_appkey=12481890
		&top_parameters=aWZyYW1lPTEmdHM9MTM0NjgxMTQ2MjY4OCZ2aXNpdG9yX2lkPTcyNjA4MTgwJnZpc2l0b3Jfbmljaz27w8%2FrZGXOtrXA&top_session=
		&module_width=190
		&envMode=prod
		&shop_id=73296719
		&seller_nick=幻想de味道
		&top_sign=NJrHXJii4W7V777NDQLgcg%3D%3D
		
		echo base64_decode('aWZyYW1lPTEmdHM9MTM0NjgxMTQ2MjY4OCZ2aXNpdG9yX2lkPTcyNjA4MTgwJnZpc2l0b3Jfbmljaz27w8%2FrZGXOtrXA');
		iframe=1&ts=1346811462688&visitor_id=72608180&visitor_nick=紫色color 
	*/
	
    public function index() {
        //echo $_GET["shop_id"];
		$data['shop_id'] = $shop_id = $_GET["shop_id"];
		$data['module_width'] = $module_width = $_GET["module_width"];
		$this->db->where('shopid',$shop_id)->where('width',$module_width)->order_by('staute','DESC')->order_by('time','DESC')->limit(2);
        $query = $this->db->get('res');
        $resarray = $query->result_array();		
		if(is_array($resarray) && count($resarray)){
			$tmparr = $resarray[0];
			$data['tmpath'] = $tmparr['tmpath'];
			$data['content'] = $tmparr['content'];
			$this->load->view('front_view',$data);
		}else{
			$this->load->view('welcome_message',$data);
		}
    }


}

/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */
//http://100.ipropre.com/index.php/front?top_appkey=12481890&module_width=750&envMode=prod&shop_id=34905576&seller_nick=幻想de味道